From 549e225c8b373be8e44274a5b2e4700c0411b4e8 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Mon, 13 Nov 2000 00:30:05 +0000 Subject: [PATCH] Fix warning when moving between paragraphs. Sun Nov 12 19:11:42 2000 Owen Taylor * gtk/gtktextlayout.c (gtk_text_layout_move_iter_to_next_line): Fix warning when moving between paragraphs. * gtk/gtkentry.[ch]: Change move => move_cursor, delete => delete_from_cursor, insert => insert_at_cursor --- ChangeLog | 8 ++++++ ChangeLog.pre-2-0 | 8 ++++++ ChangeLog.pre-2-10 | 8 ++++++ ChangeLog.pre-2-2 | 8 ++++++ ChangeLog.pre-2-4 | 8 ++++++ ChangeLog.pre-2-6 | 8 ++++++ ChangeLog.pre-2-8 | 8 ++++++ gtk/gtkentry.c | 70 ++++++++++++++++++++++----------------------- gtk/gtkentry.h | 28 +++++++++--------- gtk/gtktextlayout.c | 10 ++++++- 10 files changed, 114 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index 28ed84f957..7ad0e5c2c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sun Nov 12 19:11:42 2000 Owen Taylor + + * gtk/gtktextlayout.c (gtk_text_layout_move_iter_to_next_line): + Fix warning when moving between paragraphs. + + * gtk/gtkentry.[ch]: Change move => move_cursor, + delete => delete_from_cursor, insert => insert_at_cursor + Sun Nov 12 22:52:51 2000 Robert Brady * modules/input/imviqr.c: A vietnamese VIQR-based input method. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 28ed84f957..7ad0e5c2c0 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,11 @@ +Sun Nov 12 19:11:42 2000 Owen Taylor + + * gtk/gtktextlayout.c (gtk_text_layout_move_iter_to_next_line): + Fix warning when moving between paragraphs. + + * gtk/gtkentry.[ch]: Change move => move_cursor, + delete => delete_from_cursor, insert => insert_at_cursor + Sun Nov 12 22:52:51 2000 Robert Brady * modules/input/imviqr.c: A vietnamese VIQR-based input method. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 28ed84f957..7ad0e5c2c0 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +Sun Nov 12 19:11:42 2000 Owen Taylor + + * gtk/gtktextlayout.c (gtk_text_layout_move_iter_to_next_line): + Fix warning when moving between paragraphs. + + * gtk/gtkentry.[ch]: Change move => move_cursor, + delete => delete_from_cursor, insert => insert_at_cursor + Sun Nov 12 22:52:51 2000 Robert Brady * modules/input/imviqr.c: A vietnamese VIQR-based input method. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 28ed84f957..7ad0e5c2c0 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,11 @@ +Sun Nov 12 19:11:42 2000 Owen Taylor + + * gtk/gtktextlayout.c (gtk_text_layout_move_iter_to_next_line): + Fix warning when moving between paragraphs. + + * gtk/gtkentry.[ch]: Change move => move_cursor, + delete => delete_from_cursor, insert => insert_at_cursor + Sun Nov 12 22:52:51 2000 Robert Brady * modules/input/imviqr.c: A vietnamese VIQR-based input method. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 28ed84f957..7ad0e5c2c0 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +Sun Nov 12 19:11:42 2000 Owen Taylor + + * gtk/gtktextlayout.c (gtk_text_layout_move_iter_to_next_line): + Fix warning when moving between paragraphs. + + * gtk/gtkentry.[ch]: Change move => move_cursor, + delete => delete_from_cursor, insert => insert_at_cursor + Sun Nov 12 22:52:51 2000 Robert Brady * modules/input/imviqr.c: A vietnamese VIQR-based input method. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 28ed84f957..7ad0e5c2c0 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +Sun Nov 12 19:11:42 2000 Owen Taylor + + * gtk/gtktextlayout.c (gtk_text_layout_move_iter_to_next_line): + Fix warning when moving between paragraphs. + + * gtk/gtkentry.[ch]: Change move => move_cursor, + delete => delete_from_cursor, insert => insert_at_cursor + Sun Nov 12 22:52:51 2000 Robert Brady * modules/input/imviqr.c: A vietnamese VIQR-based input method. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 28ed84f957..7ad0e5c2c0 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +Sun Nov 12 19:11:42 2000 Owen Taylor + + * gtk/gtktextlayout.c (gtk_text_layout_move_iter_to_next_line): + Fix warning when moving between paragraphs. + + * gtk/gtkentry.[ch]: Change move => move_cursor, + delete => delete_from_cursor, insert => insert_at_cursor + Sun Nov 12 22:52:51 2000 Robert Brady * modules/input/imviqr.c: A vietnamese VIQR-based input method. diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index a1cb51773b..9996cdd9bb 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -144,26 +144,26 @@ static gboolean gtk_entry_get_selection_bounds (GtkEditable *editable, /* Default signal handlers */ -static void gtk_entry_real_insert_text (GtkEntry *entry, - const gchar *new_text, - gint new_text_length, - gint *position); -static void gtk_entry_real_delete_text (GtkEntry *entry, - gint start_pos, - gint end_pos); -static void gtk_entry_move (GtkEntry *entry, - GtkMovementStep step, - gint count, - gboolean extend_selection); -static void gtk_entry_insert (GtkEntry *entry, - const gchar *str); -static void gtk_entry_delete (GtkEntry *entry, - GtkDeleteType type, - gint count); -static void gtk_entry_cut_clipboard (GtkEntry *entry); -static void gtk_entry_copy_clipboard (GtkEntry *entry); -static void gtk_entry_paste_clipboard (GtkEntry *entry); -static void gtk_entry_toggle_overwrite (GtkEntry *entry); +static void gtk_entry_real_insert_text (GtkEntry *entry, + const gchar *new_text, + gint new_text_length, + gint *position); +static void gtk_entry_real_delete_text (GtkEntry *entry, + gint start_pos, + gint end_pos); +static void gtk_entry_move_cursor (GtkEntry *entry, + GtkMovementStep step, + gint count, + gboolean extend_selection); +static void gtk_entry_insert_at_cursor (GtkEntry *entry, + const gchar *str); +static void gtk_entry_delete_from_cursor (GtkEntry *entry, + GtkDeleteType type, + gint count); +static void gtk_entry_cut_clipboard (GtkEntry *entry); +static void gtk_entry_copy_clipboard (GtkEntry *entry); +static void gtk_entry_paste_clipboard (GtkEntry *entry); +static void gtk_entry_toggle_overwrite (GtkEntry *entry); /* IM Context Callbacks */ @@ -333,7 +333,7 @@ gtk_entry_class_init (GtkEntryClass *class) gtk_signal_new ("move_cursor", GTK_RUN_LAST | GTK_RUN_ACTION, GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkEntryClass, move), + GTK_SIGNAL_OFFSET (GtkEntryClass, move_cursor), gtk_marshal_VOID__ENUM_INT_BOOLEAN, GTK_TYPE_NONE, 3, GTK_TYPE_MOVEMENT_STEP, GTK_TYPE_INT, GTK_TYPE_BOOL); @@ -341,7 +341,7 @@ gtk_entry_class_init (GtkEntryClass *class) gtk_signal_new ("insert_at_cursor", GTK_RUN_LAST | GTK_RUN_ACTION, GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkEntryClass, insert), + GTK_SIGNAL_OFFSET (GtkEntryClass, insert_at_cursor), gtk_marshal_VOID__STRING, GTK_TYPE_NONE, 1, GTK_TYPE_STRING); @@ -349,7 +349,7 @@ gtk_entry_class_init (GtkEntryClass *class) gtk_signal_new ("delete_from_cursor", GTK_RUN_LAST | GTK_RUN_ACTION, GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkEntryClass, delete), + GTK_SIGNAL_OFFSET (GtkEntryClass, delete_from_cursor), gtk_marshal_VOID__ENUM_INT, GTK_TYPE_NONE, 2, GTK_TYPE_DELETE_TYPE, GTK_TYPE_INT); @@ -533,9 +533,9 @@ gtk_entry_class_init (GtkEntryClass *class) class->insert_text = gtk_entry_real_insert_text; class->delete_text = gtk_entry_real_delete_text; - class->move = gtk_entry_move; - class->insert = gtk_entry_insert; - class->delete = gtk_entry_delete; + class->move_cursor = gtk_entry_move_cursor; + class->insert_at_cursor = gtk_entry_insert_at_cursor; + class->delete_from_cursor = gtk_entry_delete_from_cursor; class->cut_clipboard = gtk_entry_cut_clipboard; class->copy_clipboard = gtk_entry_copy_clipboard; class->paste_clipboard = gtk_entry_paste_clipboard; @@ -1377,10 +1377,10 @@ gtk_entry_real_delete_text (GtkEntry *entry, static void -gtk_entry_move (GtkEntry *entry, - GtkMovementStep step, - gint count, - gboolean extend_selection) +gtk_entry_move_cursor (GtkEntry *entry, + GtkMovementStep step, + gint count, + gboolean extend_selection) { gint new_pos = entry->current_pos; @@ -1424,8 +1424,8 @@ gtk_entry_move (GtkEntry *entry, } static void -gtk_entry_insert (GtkEntry *entry, - const gchar *str) +gtk_entry_insert_at_cursor (GtkEntry *entry, + const gchar *str) { GtkEditable *editable = GTK_EDITABLE (entry); gint pos = entry->current_pos; @@ -1437,9 +1437,9 @@ gtk_entry_insert (GtkEntry *entry, } static void -gtk_entry_delete (GtkEntry *entry, - GtkDeleteType type, - gint count) +gtk_entry_delete_from_cursor (GtkEntry *entry, + GtkDeleteType type, + gint count) { GtkEditable *editable = GTK_EDITABLE (entry); gint start_pos = entry->current_pos; diff --git a/gtk/gtkentry.h b/gtk/gtkentry.h index 765da78f03..33f26baaff 100644 --- a/gtk/gtkentry.h +++ b/gtk/gtkentry.h @@ -106,20 +106,20 @@ struct _GtkEntryClass /* Action signals */ - void (* activate) (GtkEntry *entry); - void (* move) (GtkEntry *entry, - GtkMovementStep step, - gint count, - gboolean extend_selection); - void (* insert) (GtkEntry *entry, - const gchar *str); - void (* delete) (GtkEntry *entry, - GtkDeleteType type, - gint count); - void (* cut_clipboard) (GtkEntry *entry); - void (* copy_clipboard) (GtkEntry *entry); - void (* paste_clipboard) (GtkEntry *entry); - void (* toggle_overwrite) (GtkEntry *entry); + void (* activate) (GtkEntry *entry); + void (* move_cursor) (GtkEntry *entry, + GtkMovementStep step, + gint count, + gboolean extend_selection); + void (* insert_at_cursor) (GtkEntry *entry, + const gchar *str); + void (* delete_from_cursor) (GtkEntry *entry, + GtkDeleteType type, + gint count); + void (* cut_clipboard) (GtkEntry *entry); + void (* copy_clipboard) (GtkEntry *entry); + void (* paste_clipboard) (GtkEntry *entry); + void (* toggle_overwrite) (GtkEntry *entry); }; GtkType gtk_entry_get_type (void) G_GNUC_CONST; diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index 7487d3d20c..5bf696a593 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -2392,6 +2392,7 @@ gtk_text_layout_move_iter_to_next_line (GtkTextLayout *layout, gboolean found = FALSE; gboolean found_after = FALSE; + gboolean first = TRUE; g_return_if_fail (layout != NULL); g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout)); @@ -2405,8 +2406,15 @@ gtk_text_layout_move_iter_to_next_line (GtkTextLayout *layout, GSList *tmp_list; display = gtk_text_layout_get_line_display (layout, line, FALSE); - line_byte = line_display_iter_to_index (layout, display, iter); + if (first) + { + line_byte = line_display_iter_to_index (layout, display, iter); + first = FALSE; + } + else + line_byte = 0; + tmp_list = pango_layout_get_lines (display->layout); while (tmp_list && !found_after) { -- 2.30.2